#!/usr/bin/env bash
set -euo pipefail

REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
IMAGE_TAG="${IMAGE_TAG:-rust-os-dev}"

docker build -t "${IMAGE_TAG}" -f "${REPO_ROOT}/Dockerfile" "${REPO_ROOT}"
docker run --rm \
    -v "${REPO_ROOT}:/workspace" \
    -w /workspace/kernel \
    "${IMAGE_TAG}" \
    cargo +nightly bootimage
